home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d26 / inf_src.arc / INFERENC.H < prev    next >
C/C++ Source or Header  |  1986-03-14  |  5KB  |  110 lines

  1.  
  2.  
  3. /*****************************************************************
  4. **                                **
  5. **      Inference -- (C) Copyright 1985 George Hageman    **
  6. **                                **
  7. **        user-supported software:                **
  8. **                                **
  9. **            George Hageman                **
  10. **            P.O. Box 11234                **
  11. **            Boulder, Colorado 80302            **
  12. **                                **
  13. *****************************************************************/
  14.  
  15. /*************************************************************************
  16. **                                    **
  17. **    The software contained in this distribution is copyright (C)    **
  18. **    by George Hageman 1985 and is released into the public         **
  19. **    domain with the following restrictions:                 **
  20. **                                    **
  21. **        (1)  This software is intended for non-commertial    **
  22. **            usage.                        **
  23. **        (2)  I am held save from damages resulting from        **
  24. **            its use, and                    **
  25. **        (3)  The following concepts and legal jargon are    **
  26. **            agreed to by the user of this software.        **
  27. **                                    **
  28. **    User-supported software concept:                 **
  29. **                                    **    
  30. **    IF    you find use for this software                **
  31. **    ANDIF it saves you some development time            **
  32. **    THEN        send me $10.00                    **
  33. **    ANDTHENHYP  you will feel good!                    **
  34. **                                    **
  35. **                                    **
  36. **    This source code is provided on an "as is" basis without    **
  37. **    warranty of any kind, expressed or implied, including but    **
  38. **    not limited to the implied warranties of merchantability    **
  39. **    and fitness for a particular purpose.  The entire risk as    **
  40. **    to quality and performance of this software is with you.     **
  41. **    Should the software prove defective, you assume the entire    **
  42. **    cost of all necessary repair, servicing, or correction.  In    **
  43. **    no event will the author be liable to you for any damages,    **
  44. **    including any lost profits, lost savings, or other        **
  45. **    incidental or consequential damages arising out of the  use    **
  46. **    of inability to use this software.  In short my friends, I    **
  47. **    have done  a reasonable ammount of work in debugging this    **
  48. **    software and I think it is pretty good but, as you know,    **
  49. **    there is always some chance that a bug is still lurking     **
  50. **    around. If you should happen to be lucky enough to  find one,    **
  51. **    please let me know so I    can make an attempt to fix it.        **
  52. **                                    **
  53. **                Thanks,                    **
  54. **                                    **
  55. **                George Hageman                **
  56. **                P.O. Box 11234                **
  57. **                Boulder, Colorado 80302            **
  58. **                                    **
  59. *************************************************************************/
  60.  
  61.  
  62. /*
  63. Expert system inference engine
  64.  
  65. This inference engine is backwards-chaining only and features the
  66. running of binary files if:
  67.  
  68.     1) they are antecedents associated with a particuar consequent
  69.        being proved, or
  70.     2) they are consequents which have been proven true by verify().
  71.        their actual predicate value will be determined by their returned
  72.        result after running.
  73.  
  74. This inference engine is designed with diagnostics in mind and so will probably
  75. be best suited for this application.  Later revisons will include 
  76. forward-chaining so that the user will have the opportunity to give pre-existant
  77. conditons, or that these my be supplied by the calling process.
  78.  
  79. (If you cant tell by the above description -- I am very excited about the 
  80. possibilties presented in this form of computer control of the diagnostic
  81. process... Geo.)
  82.  
  83. See structure design for details of operation,  but basically the 
  84.  
  85. inference reads in all of the compiled information as produced by the
  86.     rule compiler.
  87.     
  88. it proceeds to attempt to prove each consequent by proving the truth
  89.     or falseness of any antecedent associated with this consequent.
  90. if any antecedent of a consequent turns out to be a consequent itself, then
  91.         the inference engine will recursively attempt to prove this consequent.
  92.  
  93. the process is complete when all of the predicate values of the consequents has
  94.     been determined.
  95.     
  96. Additional features which I may put in at a later time is the abiltiy for
  97. the inference engine to expalin itself to the user when the user asks why
  98. the inference engine needs to know the predicate value of a particular
  99. antecedent.   This will be done by forward and backward chaining of predicat
  100. clauses, the truth of each will be displayed.
  101. */
  102. #define    MAX_ANTECEDENTS        25
  103.  
  104. extern     int    numHypot, hypStack[],strBuffOfst ;
  105. extern     char    strBuff[] ;
  106. extern    int    ruleBuffOfst ;
  107. extern    int    knownTrue[], knownFalse[] ;
  108. extern    int    numTrue, numFalse ;
  109. extern    struct  rule_statement_r ruleBuff[] ;
  110.